From a8d02340e0d16d8bbb6fcf2318f0e0d70db0fb32 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 6 Jun 2005 15:17:43 +0000 Subject: [PATCH] bitkeeper revision 1.1685 (42a46917Mo_RODMmBbBtgwKKV-2YLg) Clean up show_registers(). Signed-off-by: Keir Fraser --- xen/arch/x86/x86_32/traps.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/x86_32/traps.c b/xen/arch/x86/x86_32/traps.c index b950707989..3a489f244c 100644 --- a/xen/arch/x86/x86_32/traps.c +++ b/xen/arch/x86/x86_32/traps.c @@ -8,10 +8,7 @@ #include #include #include - -#ifdef CONFIG_VMX #include -#endif /* All CPUs have their own IDT to allow int80 direct trap. */ idt_entry_t *idt_tables[NR_CPUS] = { 0 }; @@ -19,10 +16,8 @@ idt_entry_t *idt_tables[NR_CPUS] = { 0 }; void show_registers(struct cpu_user_regs *regs) { unsigned long ss, ds, es, fs, gs, cs; - unsigned long eip, esp, eflags; + unsigned long eip, esp, eflags, cr0, cr3; const char *context; -#ifdef CONFIG_VMX - unsigned long cr0, cr3; if ( VMX_DOMAIN(current) && (regs->eflags == 0) ) { @@ -40,10 +35,13 @@ void show_registers(struct cpu_user_regs *regs) context = "vmx guest"; } else -#endif { - eip = regs->eip; + eip = regs->eip; eflags = regs->eflags; + cr0 = read_cr0(); + cr3 = read_cr3(); + + __asm__ ( "movl %%fs,%0 ; movl %%gs,%1" : "=r" (fs), "=r" (gs) ); if ( GUEST_MODE(regs) ) { @@ -51,21 +49,16 @@ void show_registers(struct cpu_user_regs *regs) ss = regs->ss & 0xffff; ds = regs->ds & 0xffff; es = regs->es & 0xffff; - fs = regs->fs & 0xffff; - gs = regs->gs & 0xffff; cs = regs->cs & 0xffff; context = "guest"; } else { - esp = (unsigned long)(®s->esp); + esp = (unsigned long)®s->esp; ss = __HYPERVISOR_DS; ds = __HYPERVISOR_DS; es = __HYPERVISOR_DS; - fs = __HYPERVISOR_DS; - gs = __HYPERVISOR_DS; cs = __HYPERVISOR_CS; - context = "hypervisor"; } } @@ -78,12 +71,10 @@ void show_registers(struct cpu_user_regs *regs) regs->eax, regs->ebx, regs->ecx, regs->edx); printk("esi: %08x edi: %08x ebp: %08x esp: %08lx\n", regs->esi, regs->edi, regs->ebp, esp); + printk("cr0: %08lx cr3: %08lx\n", cr0, cr3); printk("ds: %04lx es: %04lx fs: %04lx gs: %04lx " "ss: %04lx cs: %04lx\n", ds, es, fs, gs, ss, cs); -#ifdef CONFIG_VMX - printk("cr0: %08lx cr3: %08lx\n", cr0, cr3); -#endif if ( GUEST_MODE(regs) ) show_guest_stack(); -- 2.30.2